package com.jlpay.openapi.demo.openmerch.change;

import com.jlpay.open.jlpay.sdk.java.model.openmerch.SignMode;
import com.jlpay.open.jlpay.sdk.java.model.openmerch.change.request.SignInfoModifyRequest;
import com.jlpay.open.jlpay.sdk.java.model.openmerch.change.response.SignInfoModifyResponse;
import com.jlpay.open.jlpay.sdk.java.utils.json.JsonUtils;
import com.jlpay.openapi.demo.JlpayOpenApiService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.UUID;

/**
 * 商户签约信息修改
 *
 * @author zhangyongfeng
 * @date 2025/8/1
 */
public class SignInfoModifyService {
    private static final Logger LOGGER = LoggerFactory.getLogger(SignInfoModifyService.class);

    public static void main(String[] args) {
        SignInfoModifyRequest request = buildRequest();
        SignInfoModifyResponse response = JlpayOpenApiService.openMerchWithCryptoService()
                .post(request, SignInfoModifyResponse.class);
        LOGGER.info("商户签约信息修改响应:{}", JsonUtils.toString(response));
    }

    private static SignInfoModifyRequest buildRequest() {
        SignInfoModifyRequest request = new SignInfoModifyRequest();
        request.setApplyId(UUID.randomUUID().toString().replaceAll("-", ""));
        // 商户号
        request.setMerchNo("849584358140108");
        request.setSignMode(SignMode.OFFLINE_PAPER_AGREEMENT);
        request.setAgreementPic("region-ali-oss://jlpay-test/managefile/2024/02/28/1709106666879_6c53af86b9654680a727b92795dce6c2.jpg");
        return request;
    }
}
